
-- 对阵 界面 工会信息
local GuildWarFightGuildInfoRender = app.mvc.createRenderClass(...)
local NewguildIconRender = require("app.newGuild.views.renders.NewguildIconRender")

--data =
function GuildWarFightGuildInfoRender.create(node)
    local sprite = GuildWarFightGuildInfoRender.extend(node)
    sprite:init()
    return sprite
end

function GuildWarFightGuildInfoRender:init(data)
    self.super.init(self, data)
    self._guildIconRender = NewguildIconRender.create(self._ui.icon)

    self:refresh()
end

function GuildWarFightGuildInfoRender:refresh()
    local data = self._data
    if data then
        self._ui["Panel_data"]:setVisible(true)
        self._ui["Image"]:setVisible(false)
        self._guildIconRender:setData(data:getGuildIconData())
        self._ui["Panel_data/server"]:setString(data:getServerName())
        self._ui["Panel_data/name"]:setString(data:getGuildName())
        self._ui["Panel_data/num1"]:setString(data:getGuildMemberNum())
        self._ui["Panel_data/num2"]:setString(data:getTotalPowerStr())

        local round = app:getWeekDayPassDailyUpdate()
        if round >= 6 then
            self._ui["Panel_data/ranging"]:setString(string.format(L("WGWPreGameRank"), data:getRank()))
        else
            self._ui["Panel_data/ranging"]:setString(string.format(L("WGWCurrentRank"), data:getRank()))
        end
    
    else
        self._ui["Panel_data"]:setVisible(false)
        self._ui["Image"]:setVisible(true)
    end
end

return GuildWarFightGuildInfoRender